import * as api from '@/api/social-security'

const state = {
  list: {
    rows: [],
    total: 0
  },
  cityList: [],
}

const mutations = {
  SET_LIST(state, newValue) {
    state.list = newValue
  },
  SET_CITY_LIST(state, newValue) {
    state.cityList = newValue
  },
}

const actions = {
  async updateList({ commit }, data) {
    const res = await api.getList(data)
    commit('SET_LIST', res)
  },
  async updateCityList({ commit }) {
    const res = await api.getCityList()
    commit('SET_CITY_LIST', res)
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
